package com.luych.toolbox.common.feign.view.data.service;

import com.luych.toolbox.common.enums.DataProjectStatus;
import com.luych.toolbox.common.feign.FeignView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;
import java.util.stream.Collectors;

@ApiModel("数据项目")
public class DataProjectView extends FeignView {

    @ApiModelProperty("名称")
    private String name;
    @ApiModelProperty("状态")
    private DataProjectStatus status;
    @ApiModelProperty("数据源")
    private List<DataSourceView> dataSources;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public DataProjectStatus getStatus() {
        return status;
    }

    public String getStatusValue() {
        return status == null ? null : status.getValue();
    }

    public void setStatus(DataProjectStatus status) {
        this.status = status;
    }

    public List<DataSourceView> getDataSources() {
        return dataSources;
    }

    public List<String> getDataSourceIds() {
        return dataSources == null ? null : dataSources.stream().map(DataSourceView::getId).collect(Collectors.toList());
    }

    public void setDataSources(List<DataSourceView> dataSources) {
        this.dataSources = dataSources;
    }

}
